/**
 * creater:chuanpeng.zhu@dhc.com.cn
 * create time:2016-05-31 10:22:31
 * describe:发送短信验证码指令
 */
APP.controller('SendSMSController', ['$scope', 'SendSMSService',
  function ($scope, SendSMSService) {

    /***变量声明***/
    $scope.code = '<button send-sms="60">发送验证码</button>';
    $scope.data = {
      value: ''
    };

    /**
     * 初始化函数
     */
    $scope.init = function () {

    };

    /**
     * 登录方法
     */
    $scope.sendSMS = function () {
      console.log('sendSMS.....', $scope.data.value);
      /*SendSMSService.doSendSMS($scope.username, $scope.password)
       .success(function (response, status, headers, config) {

       })
       .error(function (response, status, headers, config) {

       })*/
    };


    /*
     $scope.init();//如果页面缓存则用此方法初始化
     */
    $scope.$on('$ionicView.beforeEnter', function () {
      $scope.init();
    });
  }
]);

/**
 * creater:chuanpeng.zhu@dhc.com.cn
 * create time:2016-05-31 10:22:31
 * describe:发送短信验证码指令
 */
APP.service('SendSMSService', ['$http', 'UrlService', function ($http, UrlService) {
  /**
   * 登录方法
   * @param username  登录用户名
   * @param password  登录密码
   */
  this.doSendSMS = function (username, password) {
    var param = {
      username: username,
      password: password
    };
    $http.get(UrlService.getUrl('HOME_LOOP_AD_LIST'), param);
  }

}]);
